/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.dao;

import br.com.deployment.daogenerico.DaoGenerico;
import br.com.deployment.entidade.arquivo.Anexo;
import br.com.deployment.entidade.registroimovel.Imovel;
import br.com.deployment.interfaces.AnexoDaoIn;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author luciano
 */
@Stateless
@LocalBean
public class AnexoDao extends DaoGenerico<Anexo> implements AnexoDaoIn{
    
    public AnexoDao(){
        super(Anexo.class);
    }
    
    public List<Anexo> findAnexo(Imovel imovel){
        String sql = "Select a from Imovel i JOIN i.anexo a where "
                + " i.id = :imovel ";
        Query query = getEm().createQuery(sql);
        query.setParameter("imovel", imovel.getId());
        return query.getResultList();
    }
    
    public List<Anexo> findJuridica(Anexo arquivo) {
        return null;
    }

    public Boolean exist(int id){
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
    
}
